package com.actionsoft.ActionEvent;

import com.actionsoft.bpms.bo.engine.BO;
import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext;
import com.actionsoft.bpms.bpmn.engine.listener.ExecuteListener;
import com.actionsoft.bpms.bpmn.engine.model.run.delegate.ProcessInstance;
import com.actionsoft.sdk.local.SDK;


import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class chanagedata extends ExecuteListener implements ActionListener {
    @Override
    public void execute(ProcessExecutionContext pec) throws Exception {
        ProcessInstance process = pec.getProcessInstance();
        String pid = process.getId();
        String boname = (String)pec.getVariable("boname");
        String idname = (String)pec.getVariable("idname");
        System.out.println("<获取流程变量>boname:"+boname+"idnaem:"+idname);
        BO bo = SDK.getBOAPI().getByProcess(boname,pid);
        BO oldbo = SDK.getBOAPI().query(boname).addQuery(idname+" =",bo.get(idname)).addQuery("BINDID !=",pid).detail();
        int count = SDK.getBOAPI().remove(boname,oldbo.getId());
        System.out.println("删除的记录数"+count);
    }

    @Override
    public void actionPerformed(ActionEvent e) {

    }
}
